package com.buanalintas.sandals.pos.entities;

import com.buanalintas.bynga.entities.MasterUnit;
import com.buanalintas.bynga.entities.MasterUser;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

@Entity
@Table(name = "pos_transaction_opname")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "PosTransactionOpname.findAll", query = "SELECT p FROM PosTransactionOpname p"),
    @NamedQuery(name = "PosTransactionOpname.findBySync", query = "SELECT p FROM PosTransactionOpname p WHERE p.sync = :sync"),
    @NamedQuery(name = "PosTransactionOpname.findByOpnameId", query = "SELECT p FROM PosTransactionOpname p WHERE p.opnameId = :opnameId"),
    @NamedQuery(name = "PosTransactionOpname.findByOpnameNumber", query = "SELECT p FROM PosTransactionOpname p WHERE p.opnameNumber = :opnameNumber"),
    @NamedQuery(name = "PosTransactionOpname.findByOpnameDate", query = "SELECT p FROM PosTransactionOpname p WHERE p.opnameDate = :opnameDate"),
    @NamedQuery(name = "PosTransactionOpname.findByOpnameKnownBy", query = "SELECT p FROM PosTransactionOpname p WHERE p.opnameKnownBy = :opnameKnownBy"),
    @NamedQuery(name = "PosTransactionOpname.findByOpnameTimestamp", query = "SELECT p FROM PosTransactionOpname p WHERE p.opnameTimestamp = :opnameTimestamp")})
public class PosTransactionOpname implements Serializable {

    private static final long serialVersionUID = 1L;
    @Column(name = "sync")
    private String sync;
    @Id
    @Basic(optional = false)
    @Column(name = "opname_id")
    private Integer opnameId;
    @Column(name = "opname_number")
    private String opnameNumber;
    @Column(name = "opname_date")
    @Temporal(TemporalType.DATE)
    private Date opnameDate;
    @Column(name = "opname_known_by")
    private String opnameKnownBy;
    @Lob
    @Column(name = "opname_description")
    private String opnameDescription;
    @Column(name = "opname_timestamp")
    @Temporal(TemporalType.TIMESTAMP)
    private Date opnameTimestamp;
    @JoinColumn(name = "opname_user_id", referencedColumnName = "user_id")
    @ManyToOne
    private MasterUser opnameUserId;
    @JoinColumn(name = "opname_unit_id", referencedColumnName = "unit_id")
    @ManyToOne
    private MasterUnit opnameUnitId;

    public PosTransactionOpname() {
    }

    public PosTransactionOpname(Integer opnameId) {
        this.opnameId = opnameId;
    }

    public String getSync() {
        return sync;
    }

    public void setSync(String sync) {
        this.sync = sync;
    }

    public Integer getOpnameId() {
        return opnameId;
    }

    public void setOpnameId(Integer opnameId) {
        this.opnameId = opnameId;
    }

    public String getOpnameNumber() {
        return opnameNumber;
    }

    public void setOpnameNumber(String opnameNumber) {
        this.opnameNumber = opnameNumber;
    }

    public Date getOpnameDate() {
        return opnameDate;
    }

    public void setOpnameDate(Date opnameDate) {
        this.opnameDate = opnameDate;
    }

    public String getOpnameKnownBy() {
        return opnameKnownBy;
    }

    public void setOpnameKnownBy(String opnameKnownBy) {
        this.opnameKnownBy = opnameKnownBy;
    }

    public String getOpnameDescription() {
        return opnameDescription;
    }

    public void setOpnameDescription(String opnameDescription) {
        this.opnameDescription = opnameDescription;
    }

    public Date getOpnameTimestamp() {
        return opnameTimestamp;
    }

    public void setOpnameTimestamp(Date opnameTimestamp) {
        this.opnameTimestamp = opnameTimestamp;
    }

    public MasterUnit getOpnameUnitId() {
        return opnameUnitId;
    }

    public void setOpnameUnitId(MasterUnit opnameUnitId) {
        this.opnameUnitId = opnameUnitId;
    }

    public MasterUser getOpnameUserId() {
        return opnameUserId;
    }

    public void setOpnameUserId(MasterUser opnameUserId) {
        this.opnameUserId = opnameUserId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (opnameId != null ? opnameId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof PosTransactionOpname)) {
            return false;
        }
        PosTransactionOpname other = (PosTransactionOpname) object;
        if ((this.opnameId == null && other.opnameId != null) || (this.opnameId != null && !this.opnameId.equals(other.opnameId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.buanalintas.sandals.pos.entities.PosTransactionOpname[ opnameId=" + opnameId + " ]";
    }
}
